#-*- coding:utf-8 -*-
'''
Created on 24.03.2010

@author: hu1salh1
'''
from optparse import OptionParser, SUPPRESS_HELP
import optparse
import time

def parse_args():
	parser=optparse.OptionParser(add_help_option=False)
	add=parser.add_option
	#--- указание всех ключей параметров для введения данных при запуске через консоль    
	add('-h','--help',
		action = "help",
		help = "Show this message")
	add('-t','--table',
		action="store",
		dest='table',
		default='dev',
		help="Table name")
	add('-a','--all',
		action="store_true",
		dest='all_field',
		default=False,
		help="Output all field in result")
	add('-n',
		action="store",
		dest='n_count',
		default=30,
		help="How much result string to print on screen")
	add('--abc',
		action="store",
		dest='abc',
		default='desc',
		help="Order by DESC or ASC")
	add('-l',
		action="store_true",
		dest='log',
		default=False,
		help="If you need otput to log file")
	add('--log',
		action="store",
		dest='log_name',
		default=time.strftime("PAUK_%d.%m.%Y_%H-%M-%S")+'.log',
		help="If you need log file with your filename")
	add('--ip',
		action="store_true",
		dest='f_ip',
		default=False,
		help="IP to output")
	add('--dev',
		action='store_true',
		dest='f_dev',
		default=False,
		help='Device name to output')
	add('--cmp',
		action='store_true',
		dest='f_frm',
		default=False,
		help='Comp name to output')
	add('--mac',
		action='store_true',
		dest='f_mac',
		default=False,
		help='MAC to output')
	add('--inv',
		action='store_true',
		dest='f_inv',
		default=False,
		help='Inventory number to output')
	add('--time',
		action='store_true',
		dest='f_time',
		default=False,
		help='Time to output')
	#--------------------------------------sort
	add('--s_ip',
		action="store",
		dest='s_ip',
		default=False,
		help="sort like IP")
	add('--s_dev',
		action='store',
		dest='s_dev',
		default=False,
		help='sort like Device name to output')
	add('--s_cmp',
		action='store',
		dest='s_frm',
		default=False,
		help='sort like Comp name')
	add('--s_mac',
		action='store',
		dest='s_mac',
		default=False,
		help='sort like MAC')
	add('--s_inv',
		action='store',
		dest='s_inv',
		default=False,
		help='sort like Inventory number')
	add('--s_time',
		action='store',
		dest='s_time',
		default=False,
		help='sort like Time')
	#---------------------------------find
	add('--usfrm',
		action='store',
		dest='user_frame',
		default=False,
		help='find user of frame')
	add('--frusr',
		action='store',
		dest='frame_user',
		default=False,
		help='find frame of user')
	add('--roomfrm',
		action='store',
		dest='room_frame',
		default=False,
		help='find room of frame')
	add('--roomusr',
		action='store',
		dest='room_user',
		default=False,
		help='find room of user')
	#--- конец ввода параметров
	return parser.parse_args()
